﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Urbania.Utilities
{
    public class UserStats
    {

        protected static UserStats singleton;

        public double Gold { get; set; }
        public double GoldPer5 { get; set; }
        public double Happiness { get; set; }
        public double Population { get; set; }
        public double Food { get; set; }
        public double Pollution { get; set; }
        public double PollutionPer5{ get; set; }
        public double BureaucracyPoints { get; set; }
        public double PropertyValue { get; set; }

        protected double score;


        public static UserStats GetUserStats()
        {
            if (singleton == null) singleton = new UserStats(0);
            return singleton;
        }

        private UserStats(double gold)
        {
            this.Gold = gold;
            this.GoldPer5 = 1;
            this.Happiness = 0;
            this.HappinessPer5 = 0;
            this.Population = 1;
            this.Food = 1;
            this.Pollution = 0;
            this.PollutionPer5 = 0;
            this.BureaucracyPoints = 0;
        }


        public double calculateScore(double gameTime)
        {
            this.score = (gameTime / 10000) + 10 * (Happiness + (Food - Pollution ) / Population + PropertyValue + BureaucracyPoints);
            this.score *= .1;
            return score;
        }

        public double calculateAproval()
        {
            return (double)MathHelper.Clamp((float)(HappinessPer5 * (100 - PollutionPer5)),0,100);
        }


        public double HappinessPer5 { get; set; }
    }
}
